﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Supermarket;
using AForge_zxing;

namespace XLSupermarket.Storehouse.Commodity_warehousing
{
    public partial class Commodity_warehousing_table : Form
    {
        public Commodity_warehousing_table()
        {
            InitializeComponent();
        }

        private void Select() {
            try { 
            string sql = "Select * from Goods_Warehousing GW,Supplier SL,Goods_Type GT where GW.GoodsType_ID=GT.GoodsType_ID and SL.Supplier_ID=GW.Supplier_ID and GW.Bar_code like '%"+textBox1.Text+"%'";
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource = DBHelper.FillData(sql);
            }
            catch (Exception ex)
            {
                MessageBox.Show("出现错误：" + ex.Message);
            }
        }

        private void Commodity_warehousing_table_Load(object sender, EventArgs e)
        {
            Select();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Select();
        }

        private void button6_Click(object sender, EventArgs e)
        {
            try { 
            Form1 AF = new Form1();
            DialogResult result = AF.ShowDialog();
            if (result == DialogResult.OK)
            {
                this.textBox1.Text = AF.reisbn;
            }
            }
            catch (Exception ex)
            {
                MessageBox.Show("出现错误：" + ex.Message);
            }
        }
    }
}
